<template>
  <body>
    <div class="addPlan">
      <el-row>
        <el-col :span="20">
          <div class="plan">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane label="基本信息" name="information">
                <el-form :model="addplan" ref="plan">
                  <el-form-item prop="name">
                    <el-row>
                      <el-col :span="3">
                        <span class="span">教学计划名称</span>
                      </el-col>
                      <el-col :span="19">
                        <el-input size="mini" v-model="addplan.name" placeholder="请输入教学计划名称"></el-input>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <el-form-item prop="courseIds">
                    <el-row>
                      <el-col :span="3">
                        <span class="span">所属课程</span>
                      </el-col>
                      <el-col :span="19">
                        <div>
                          <el-select @click.native="affiliatedcourses" size="mini" v-model="addplan.courseIds" slot="prepend" placeholder="请选择所属课程">
                            <el-option v-for="item in listPlan" :value="item.course.course_name" :key="item.course.course_id">{{item.course.course_name}}</el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <el-form-item>
                    <el-row>
                      <el-col :span="3">
                        <span class="span">学分</span>
                      </el-col>
                      <el-col :span="19">
                        <el-input size="mini" v-model="credit" placeholder="请输入学分"></el-input>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <el-form-item>
                    <el-row>
                      <el-col :span="3">
                        <span class="span">学时</span>
                      </el-col>
                      <el-col :span="19">
                        <el-input size="mini" v-model="classHour" placeholder="请输入学时"></el-input>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <div style="margin: 10px 0;"></div>
                  <el-form-item>
                    <el-row>
                      <el-col :span="3">
                        <span class="span">说明</span>
                      </el-col>
                      <el-col :span="19">
                        <el-input size="mini" type="textarea" :autosize="{ minRows: 1.5, maxRows: 4}" placeholder="请输入教学方法" v-model="explain"></el-input>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <el-form-item>
                    <el-row>
                      <el-col :span="3">
                        <span class="span">持续时间</span>
                      </el-col>
                      <el-col :span="19">
                        <el-input-number size="mini" v-model="continueTime" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
                      </el-col>
                    </el-row>
                  </el-form-item>
                  <el-form-item>
                    <el-row>
                      <el-col :span="5">
                         <el-button type="primary" size="mini">生成模板</el-button>
                         <el-button type="primary" size="mini">取消</el-button>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </el-form>
              </el-tab-pane>
              <el-tab-pane label="多余的知识点列表" name="second"></el-tab-pane>
            </el-tabs>
          </div>
        </el-col>
      </el-row>
    </div>
  </body>
</template>

<script>
import http from '@/utils/HttpUtil'
export default {
  data () {
    return {
      activeName: 'information',
      addplan: {
        name: '',
        courseIds: ''
      },
      active: {
        listCourses: 'LearningPlatform/manager/course/listCourses'
      },
      listPlan: [],
      course: '',
      credit: '',
      classHour: '',
      explain: '',
      continueTime: ''
    }
  },
  components: {

  },
  methods: {
    handleClick (tab, event) {
      console.log(tab, event)
    },
    handleChange (value) {
      console.log(value)
    },
    affiliatedcourses () {
      http.xhrGet(this, this.active.listCourses, null, (res) => {
        this.listPlan = res.data.data.list
      })
    }
  }
}
</script>

<style scoped="scoped">
  @import url("../assets/css/addPlan.css");
</style>
